public class test01 {
    private static void seriof(){
        long x=1000_000_000l;
        int d1=0;
        int d2=0;
        long bigin=  System.currentTimeMillis();
        for (int i=0;i<x;i++){
            d1++;
        }
        for (int i = 0; i <x ; i++) {
            d2++;
        }
        long end=System.currentTimeMillis();
        System.out.println("串行完成时间："+(end-bigin));
    }

    public static void main(String[] args) {
        seriof();
        bin();
    }
    private static void bin(){
        long begin=System.currentTimeMillis();
        Thread thread1=new Thread(()->{
            long x=1000_000_000l;
            int d1=0;
            for (int i=0;i<x;i++){
                d1++;
            }
        });
        Thread thread2=new Thread(()->{
            long x=1000_000_000l;
            int d2=0;
            for (int i=0;i<x;i++){
                d2++;
            }
        });
        thread1.start();
        thread2.start();
        try {
            thread1.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        try {
            thread2.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        long end =System.currentTimeMillis();
        System.out.println("并行实现的时间"+(end-begin));
    }
}
